import uvicorn
from fastapi import FastAPI


# docs_url=None: 代表关闭SwaggerUi
# redoc_url=None: 代表关闭redoc文档
app = FastAPI(docs_url=None, redoc_url=None)


@app.get("/")
async def index():
    """
    注册一个根路径
    :return:
    """
    return {"message": "Hello World"}


@app.get("/info")
async def info():
    """
    项目信息
    :return:
    """
    return {
        "app_name": "FastAPI框架学习",
        "app_version": "v0.0.1"
    }


if __name__ == "__main__":
    uvicorn.run(app, host="127.0.0.1", port=8000)